import pandas as pd
import sacrebleu


def get_bleu_score(hyps,refs,**kwargs,):
    assert len(hyps) == len(refs)
    score = sacrebleu.corpus_bleu(hyps,[refs],**kwargs).score
    print("sacrebleu:", round((score), 2))
    return score


if __name__ == '__main__':
    df = pd.read_excel(r'C:\Users\admin\Desktop\翻译.xlsx', sheet_name='qwen3-235B-A22B')

    flag = '.7'
    target = df[f'目标语言{flag}'].unique()
    print(target)
    trans_texts = df[f'qwen3-235B-A22B翻译{flag}'].tolist()
    print(trans_texts)
    ref_texts = df[f'google翻译{flag}'].tolist()
    print(ref_texts)
    score = sacrebleu.corpus_bleu(trans_texts,[ref_texts], tokenize='spm').score
    print("sacrebleu:", round((score), 2))
